<html>
<head>
    <title>Title</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
    欢迎<span></span>登录<br/>
    <a href = "#" onclick="javascript:void (0);" >密码修改</a>
    <script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        let account = localStorage.getItem("account");
        $("span").text(account);

        $("a").click(function (){
            let token = localStorage.getItem("token")
            $.ajax({
                url: 'http://127.0.0.1:8080/jwt/user/updatePwd',
                type: 'GET',
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('Authorization', 'Bearer ' + token);
                },
                success: function(result) {
                    if(result.code == "200"){
                        alert("修改成功");
                    }else if(result.code == "401"){
                        location.href = "login.html";
                    }
                }

            });
        });
    </script>

</body>
</html>